
<div class="col-sm-12">
	<div class="box margin-middle max-width">
		<!-- BOX-BODY -->
		<div class="box-body">
			{{#bs-form formLayout=formLayout model=roomModel invalid=(action "invalid")}}
			<div class="row">
				<div class="col-xs-12">
					<p class="user-add-btn">
						{{#if detailEdit}}
						{{else}}
							{{#unless bedList}}
							{{#ui/form-function editAction="detailEditClick" detailEditClick="detailEditClick"
							removeAction="delById" delById="delById" editNone=true}}
							{{/ui/form-function}}
							{{/unless}}
							{{#ui/form-function editAction="detailEditClick" detailEditClick="detailEditClick"
							removeAction="delById" delById="delById" deleteNone=true}}
							{{/ui/form-function}}
						{{/if}}
					</p>
				</div>
				<!-- 列表详细介绍 -->
				<div class="col-xs-12 nopadding-left">
					<div class="col-xs-12 nopadding-horizontal mt20">

						<div class="col-xs-12 col-sm-6">
							<div class="form-input-group">
								<span class="input-group-addon">房间编号：</span>
									{{#if detailEdit}}
										{{#if id}}
										{{#bs-form-element class="col-sm-4  form-input-group" controlType="name"  property="name" }}
											{{input type="text" class="full-width" value=roomModel.name placeholder="起始编号"}}
										{{/bs-form-element}}
										{{else}}
										{{#bs-form-element class="col-sm-4 form-input-group" controlType="name"  property="name" }}
												{{input type="text" class="full-width" value=roomModel.name placeholder="起始编号"}}
										{{/bs-form-element}}
											{{#if batch}}
											<span class="pull-left"  style="line-height:35px;">~</span>
											{{#bs-form-element class="col-sm-4 form-input-group" controlType="maxName"  property="maxName" }}
												{{input type="text" class="full-width" value=roomModel.maxName placeholder="结束编号"}}
											{{/bs-form-element}}
											{{/if}}
											<span class="col-sm-3 nopadding-left nopadding-right pull-right" style="line-height:35px;text-align:right;"><i class="fa {{if batch 'fa-check-square-o' 'fa-square-o'}}" {{action 'batchAdd' on="click"}}></i>批量添加房间</span>
										{{/if}}
									{{else}}
										<div class="input-group-content">{{roomInfo.name}}</div>
									{{/if}}


							</div>

						</div>

						<div class="col-xs-12 col-sm-6">
							<div class="form-input-group">
								<span class="input-group-addon">房间朝向：</span>
								{{#if detailEdit}}
									{{#if id}}
											{{callbusi/dict-selector groupCode=constants.roomDirection curDict=roomModel.orientation
				                showName=roomInfo.orientation.typename dictSelect="orientationSelect" preselected=false value=roomModel.orientation}}
									{{else}}
											{{callbusi/dict-selector groupCode=constants.roomDirection curDict=roomModel.orientation
												showName='房间朝向' dictSelect="orientationSelect" preselected=false value=roomModel.orientation}}
									{{/if}}

								{{else}}
									<div class="input-group-content">{{roomInfo.orientation.typename}}</div>
								{{/if}}

							</div>

						</div>
						{{#unless detailEdit}}
						<div class="col-xs-12 col-sm-6">
							<div class="form-input-group">
								<span class="input-group-addon">房间类型：</span>
								<div class="input-group-content">{{roomInfo.roomType.typename}}</div>
							</div>
						</div>
						{{/unless}}
						<div class="col-xs-12 col-sm-6">
							<div class="form-input-group">
								<span class="input-group-addon">房间面积(㎡)：</span>
								{{#if detailEdit}}
									{{#if id}}
									{{#bs-form-element class="inline-block form-input-group" }}
										{{input type="text" class="full-width padding-left-8 inline-block form-input-group label-normal" value=roomInfo.area placeholder='房间面积'}}
									{{/bs-form-element}}
									{{else}}
									{{#bs-form-element class="inline-block form-input-group"  }}
										{{input type="text" class="full-width padding-left-8 inline-block form-input-group label-normal" value=roomInfo.area placeholder='房间面积'}}
									{{/bs-form-element}}
									{{/if}}
								{{else}}
									<div class="input-group-content">{{roomInfo.area}}</div>
								{{/if}}
							</div>

						</div>

						<div class="col-xs-12 col-sm-6">
							<div class="form-input-group">
								<span class="input-group-addon">所属楼宇：</span>
								{{#if detailEdit}}
								{{#bs-form-element class="inline-block form-input-group" controlType="build"  property="build" }}
									{{#power-select class="input-group-content" placeholder='楼宇名称' options=buildingList  selected=defaultBuilding searchField="namePinyin"
									noMatchesMessage="没有相关内容"	allowClear=false onchange=(action "selectBuilding" ) as |building|}}
										{{building.name}}
									{{/power-select}}
								{{/bs-form-element}}
								{{else}}
									<div class="input-group-content">{{roomInfo.floor.building.name}}</div>
								{{/if}}
							</div>

						</div>

						<div class="col-xs-12 col-sm-6">
							<div class="form-input-group">
								<span class="input-group-addon">所属楼层：</span>
								{{#if detailEdit}}
								{{#bs-form-element class="inline-block form-input-group" controlType="floor"  property="floor" }}
								{{#power-select class="input-group-content" placeholder='楼层名称' options=floorList  selected=defaultFloor searchField="namePinyin"
								noMatchesMessage="没有相关内容"	allowClear=false onchange=(action "selectFloor" ) as |floor|}}
									{{floor.allName}}
								{{/power-select}}
								{{/bs-form-element}}
								{{else}}
									<div class="input-group-content">{{roomInfo.floor.building.name}}-{{roomInfo.floor.name}}</div>
								{{/if}}
							</div>
						</div>

						<div class="col-xs-12 col-sm-6">
							<div class="form-input-group">
								<span class="input-group-addon">是否带独立卫生间：</span>
								{{#if detailEdit}}
								<select class="input-group-content" onchange={{action 'toiletChange' value="target.value"}}>
									<option value="是" selected={{isToilet}}>是</option>
		              <option value="否" selected={{noToilet}}>否</option>
		            </select>
								{{else}}
									<div class="input-group-content">{{roomInfo.hasToilet}}</div>
								{{/if}}
							</div>
						</div>

						<div class="col-xs-12 col-sm-6">
							<div class="form-input-group">
								<span class="input-group-addon">是否带阳台：</span>
								{{#if detailEdit}}
								<select class="input-group-content" onchange={{action 'balconyChange' value="target.value"}}>
									<option value="是" selected={{isBalcony}}>是</option>
		              <option value="否" selected={{noBalcony}}>否</option>
		            </select>
								{{else}}
									<div class="input-group-content">{{roomInfo.hasBalcony}}</div>
								{{/if}}
							</div>
						</div>

						{{#if id}}
							<div class="col-xs-12 col-sm-6">
								<div class="form-input-group">
									<span class="input-group-addon">华米扫描器：</span>
										{{#if detailEdit}}
											{{#power-select class="inline-block input-group-content" placeholder="" options=deviceList selected=roomInfo.scanner searchField="seq"
												 allowClear=false onchange=(action "selectScanner") as |scanner|}}
												 {{scanner.seq}}
										 	{{/power-select}}
										{{else}}
											<div class="input-group-content">{{roomInfo.scanner.seq}}</div>
										{{/if}}
								</div>
							</div>
						{{/if}}

						<div class="col-xs-12 col-sm-12">
							<div class="form-input-group">
								<span class="input-group-addon">备注：</span>
								{{#if detailEdit}}
									{{#if id}}
										{{textarea type="text" class="full-width inline-block form-input-group label-normal form-control" value=roomInfo.remark}}
									{{else}}
											{{textarea type="text" class="full-width inline-block form-input-group label-normal form-control" value=roomInfo.remark placeholder='备注'}}
									{{/if}}
								{{else}}
									<div class="input-group-content">{{roomInfo.remark}}</div>
								{{/if}}
							</div>
							<div class="divide-10"></div>
						</div>


						<div class="col-xs-12 bed-list nopadding-left nopadding-right mt20">
							<div class="col-sm-3 title">床位信息</div>
							<div class="col-sm-3 num">数量：{{bedList.length}}</div>
							{{#if detailEdit}}
							<div class="col-sm-4 plus pull-right">
								{{#ui/mix-button class="user-btn pull-right" iconClass="fa-plus" needDoubleClickPrevent=false text='新增床位'  clickAction="addBed" addBed="addBed" clickActParams=bedList}}
			          {{/ui/mix-button}}
							</div>
							{{/if}}
						</div>
						<div class="col-xs-12 bed-list">
							<table id="datatable1" cellpadding="0" cellspacing="0" border="0" class="datatable table table-hover dataTable" aria-describedby="datatable1_info">
			          <thead>
			            <tr role="row">
			              <th rowspan="1" colspan="1">床位名称</th>
			              <th rowspan="1" colspan="1">床位类型</th>
			              <th rowspan="1" colspan="1">日价格(元/天)</th>
										<th rowspan="1" colspan="1">月价格(元/月)</th>
										<th rowspan="1" colspan="1">华米按键</th>
										<th rowspan="1" colspan="1">使用状态</th>
										{{#if detailEdit}}
										<th rowspan="1" colspan="1">操作</th>
										{{/if}}
			            </tr>
			          </thead>
			          <tbody role="alert" aria-live="polite" aria-relevant="all" class="">
			            {{#each bedList as |bed|}}
			            <tr>
			              <td class="ellipsis">
											{{#if detailEdit}}
													{{input type="text" class="padding-left-8 full-width inline-block form-input-group label-normal" value=bed.name placeholder='床位编号'}}
											{{else}}
												{{bed.name}}
											{{/if}}
										</td>
			              <td class="ellipsis" >
											{{#if detailEdit}}
												{{callbusi/dict-selector class="inline-block" curDict=bed.bedType groupCode=constants.bedType
													showName=bed.bedType.typename value=bed.bedType preselected=false}}
											{{else}}
												{{bed.bedType.typename}}
											{{/if}}
										</td>
			              <td class="ellipsis" width="15%">
											{{#if detailEdit}}
													{{input type="text" class="padding-left-8 full-width inline-block form-input-group label-normal" value=bed.price placeholder='日价格'}}
											{{else}}
												{{bed.price}}
											{{/if}}
										</td>
										<td class="ellipsis" width="15%">
											{{#if detailEdit}}
													{{input type="text" class="padding-left-8 full-width inline-block form-input-group label-normal" value=bed.totalPrice placeholder='月价格'}}
											{{else}}
												{{bed.totalPrice}}
											{{/if}}
										</td>
										<td class="ellipsis" >
									 	 {{#if detailEdit}}
										 {{#power-select class="inline-block input-group-content" placeholder="" options=buttonList selected=bed.button searchField="seq"
										 allowClear=false onchange=(action "selectDevice" bed) as |button|}}
										 {{button.seq}}
										 {{/power-select}}
									 	 {{else}}
									 		 {{bed.button.seq}}
									 	 {{/if}}
									  </td>


										<td class="ellipsis" >
												{{bed.useStatus}}
										</td>
										{{#if detailEdit}}
										<td class="ellipsis" >
											{{#if bed.del}}
											<i class="fa-trash-o" {{action 'delBed' bed on="click"}}></i>
											{{/if}}
										</td>
										{{/if}}
			            </tr>
			            {{/each}}
			          </tbody>
			        </table>
						</div>


						</div>
					</div>
				</div>
				<!-- 列表详细介绍 -->

			{{/bs-form}}
			<div class="text-center padding-top30">
					<p class="text-center user-add-btn" style="display:inline-block;margin:0 auto!important ">
					{{#if detailEdit}}
					{{#if addModel}}
					{{#ui/mix-button class="user-btn edit-btn" iconClass="fa fa-check"  text='保存' clickAction="saveRoom" saveRoom="saveRoom"}}
					{{/ui/mix-button}}
					{{else}}
					{{#ui/mix-button class="user-btn edit-btn" iconClass="fa fa-check"  text='保存' clickAction="editRoom" editRoom="editRoom"}}
					{{/ui/mix-button}}
					{{/if}}
					{{#ui/mix-button class="user-btn times-btn" iconClass="fa fa-mail-reply"  text='取消'  clickAction="detailCancel" detailCancel="detailCancel" }}
					{{/ui/mix-button}}
					{{else}}
					{{/if}}
					</p>
			</div>
		</div>
		<!-- /BOX-BODY -->

	</div>
</div>
{{#if showpopInvitePassModal}}
	{{#bs-modal body=false footer=false header=false closedAction=(action "invitation")
	submitAction=(action "cancelPassSubmit" roomInfo)}}
		{{#bs-modal-header}}
			<h3 class="modal-title">删除提示</h3>
		{{/bs-modal-header}}
		{{#bs-modal-body}}
			<h4 class="modal-title">是否删除该条记录？</h4>
		{{/bs-modal-body}}
		{{#bs-modal-footer as |footer|}}
			{{#bs-button action=(action "cancelPassSubmit" roomInfo) type="primary" disabled=prepaidDisabled}}确定{{/bs-button}}
			{{#bs-button action=(action "invitation") type="default"}}取消{{/bs-button}}
		{{/bs-modal-footer}}
	{{/bs-modal}}
{{/if}}
